import java.util.Arrays;
import java.util.Scanner;

public class StringDemo04 {
    public static void main(String[] args) {
        String s = "我爱你,你爱他";
        System.out.println(s.replace("你", "她"));

        String s1 = "大丈夫能屈能伸,岂能郁郁久居人下";
        System.out.println(Arrays.toString(s1.split(",")));// 太常用了
        System.out.println(s1.split(",")[0]);

        String s2 = "1234567890";
        System.out.println(s2.substring(3));// 截取
        System.out.println(s2.substring(3, 6));

        String s3 = "你爱他";
        System.out.println(Arrays.toString(s3.toCharArray()));// 转换char数组

        String s4 = "abc";
        System.out.println(s4.toUpperCase());
        String s5 = "ABC";
        System.out.println(s5.toLowerCase());

        String s6 = " 我 爱你 ";
        System.out.println(s6);
        System.out.println(s6.trim());

        int i = 1;
        System.out.println(i + "");// 转字符串

        boolean b = true;
        System.out.println(String.valueOf(b));

        Scanner scanner = new Scanner(System.in);
        System.out.println(String.valueOf(scanner));
    }
}
